:header
call %working_dir%\header.cmd
REM 1-MakePE Directory.cmd

ECHO This will delete and re-create a directory called %wim_dest%
ECHO.
CALL notice.cmd

:Main Menu
ECHO -------------------------------------
ECHO            Make Mount Menu          
ECHO -------------------------------------
ECHO.
ECHO 1. Set arch-type (32 or 64)
ECHO 2. Make Directory
ECHO Q. Quit to Main Menu
ECHO.
ECHO.

REM ========== Choice Logic ============
choice /c:12q /n /m "%choice_text%"
if errorlevel 3 goto :end
if errorlevel 2 goto :makedir
if errorlevel 1 goto :set-type

goto :Main Menu

:set-type
call %working_dir%\header.cmd
ECHO.
ECHO -------------------------------------
ECHO            Set Arch-Type Menu          
ECHO -------------------------------------
ECHO.
ECHO 1. 32bit
ECHO 2. 64bit
ECHO Q. Quit to Main Menu
ECHO.
ECHO.
REM ========== Choice Logic ============
choice /c:12q /n /m "%choice_text%"
if errorlevel 3 goto :end
if errorlevel 2 goto :64bit
if errorlevel 1 goto :32bit

:32bit
ECHO.
ECHO setting arch-type to 32bit
set arch-type=x86
set wim_dest=%systemdrive%\Images\%arch-type%
goto :header

:64bit
ECHO.
ECHO setting arch-type to 64bit
set arch-type=amd64
set wim_dest=%systemdrive%\Images\%arch-type%
goto :header


:makedir
ECHO.
rd /s/q %wim_dest%
goto :WAIK

:WAIK
REM Change DIR to Windows AIK
cd "%waik%\petools"
call copype.cmd %arch-type% %wim_dest%
copy "%wim_dest%\winpe.wim" "%wim_dest%\ISO\sources\boot.wim"
ECHO Created Directory %wim_dest%
start %wim_dest%
pause
goto :end

:end
call %working_dir%\end.cmd